package com.adopapa.ethexplorer.domain;

import java.time.Instant;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
@Table(name = "USER_INFO")
public class UserInfo extends BaseUuidEntity {

	private static final long serialVersionUID = -4560587851006661232L;

	@Column(name = "login_name")
	private String loginName;
	@JsonIgnore
	@Column(name = "login_pwd")
	private String loginPwd;
	@Column(name = "user_name")
	private String userName;
	@Column(name = "user_type")
	private UserType userType;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
	@Column(name = "create_time")
	private Instant createTime;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
	@Column(name = "update_time")
	private Instant updateTime;
	@Column(name = "note", length = 1000)
	private String note;
	
	@OneToOne
	@JoinColumn(name = "wallet")
	private WalletInfo walletInfo;

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public UserInfo loginName(String loginName) {
		this.loginName = loginName;
		return this;
	}

	public String getLoginPwd() {
		return loginPwd;
	}

	public void setLoginPwd(String loginPwd) {
		this.loginPwd = loginPwd;
	}

	public UserInfo loginPwd(String loginPwd) {
		this.loginPwd = loginPwd;
		return this;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public UserInfo userName(String userName) {
		this.userName = userName;
		return this;
	}

	public UserType getUserType() {
		return userType;
	}

	public void setUserType(UserType userType) {
		this.userType = userType;
	}

	public UserInfo userType(UserType userType) {
		this.userType = userType;
		return this;
	}

	public Instant getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Instant createTime) {
		this.createTime = createTime;
	}

	public UserInfo createTime(Instant createTime) {
		this.createTime = createTime;
		return this;
	}

	public Instant getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Instant updateTime) {
		this.updateTime = updateTime;
	}

	public UserInfo updateTime(Instant updateTime) {
		this.updateTime = updateTime;
		return this;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public UserInfo note(String note) {
		this.note = note;
		return this;
	}

	public WalletInfo getWalletInfo() {
		return walletInfo;
	}

	public void setWalletInfo(WalletInfo walletInfo) {
		this.walletInfo = walletInfo;
	}

	public UserInfo walletInfo(WalletInfo walletInfo) {
		this.walletInfo = walletInfo;
		return this;
	}

	/////////////////////////////////////
	public static enum UserType {
		SUPERADMIN, ADMIN, OPERATOR,;
	}

}
